package ro.upt.dcda.web.admin;

import java.util.Map;

import ro.upt.dcda.pricezone.s1.pojo.Admin;
import ro.upt.dcda.pricezone.s1.requests.admin.AdminNewProductRequest;

import com.opensymphony.xwork2.ActionContext;

public class AdminAddProductServlet {

	private String name;
	private String description;

	public String execute() throws Exception {
		System.out.println("Viewing products");
		Map<String, Object> session = ActionContext.getContext().getSession();
		Admin admin = (Admin) session.get("admin");
		String adminSid = (String) session.get("adminSid");
		if (admin == null || adminSid == null) {
			return "noAuth";
		}
		try {
			AdminNewProductRequest request = new AdminNewProductRequest();
			request.work(name, description);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "def";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
